import QtQuick 2.9
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import FluentUI

Rectangle
{
    id : itemrect
    width: 150;
    height: 50
    color: Qt.rgba(255, 255, 255, 0.5) // 设置半透明背景颜色
    property var text: ""
    border.color: "gray"
    border.width: isclicked ? 0:1
    property int index: 0

    property bool isclicked: false
    signal mclicked(int index);  //自定义信号

    function clearColor()
    {
        color = "#000000"
        isclicked = false
    }  
    Text {
        anchors.centerIn: parent
        text: itemrect.text
        color: "white"
    }

    MouseArea{
        anchors.fill: parent
        hoverEnabled: true
        propagateComposedEvents:true

        onClicked: {
            parent.color = "#98A9EE"
            mclicked(index);
            if(index===0){
                loginPage.visible = true
                analyiz.visible = false
            } else if(index === 1) {
                loginPage.visible = false
                analyiz.visible = true
            } else {
                loginPage.visible = false
                analyiz.visible = false
            }
            isclicked = true
        }

        onEntered:
        {
            if (!isclicked)
                parent.color = "#767C7C"
        }

        onExited:
        {
            if (!isclicked)
                parent.color = "#000000"
        }

    }
}
